package com.cat.greedyAlgorithm;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/minimum-operations-to-make-binary-array-elements-equal-to-one-ii/description/
 * @create 2025/8/25 10:13
 * @since JDK17
 */

public class Solution29 {
    public int minOperations(int[] nums) {
        int n = nums.length, ans = 0;
        for (int i = 0; i < n; i++) {
            if (nums[i] != ans % 2) {
                ans++;
            }
        }
        return ans;
    }
}
